package com.drug.mingkang.service.impl;

import com.drug.mingkang.model.ImmPurchaseDeatis;
import com.drug.mingkang.mapper.ImmPurchaseDeatisMapper;
import com.drug.mingkang.model.vo.ImmPurchaseDeatisVo;
import com.drug.mingkang.service.ImmPurchaseDeatisService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (ImmPurchaseDeatis)表服务实现类
 *
 * @author wenchangjian
 * @since 2020-08-11 12:00:14
 */
@Service("immPurchaseDeatisService")
public class ImmPurchaseDeatisServiceImpl implements ImmPurchaseDeatisService {
    @Resource
    private ImmPurchaseDeatisMapper immPurchaseDeatisMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param deatisId 主键
     * @return 实例对象
     */
    @Override
    public ImmPurchaseDeatis queryById(String deatisId) {
        return this.immPurchaseDeatisMapper.queryById(deatisId);
    }



    /**
     * 新增数据
     *
     * @param immPurchaseDeatis 实例对象
     * @return 实例对象
     */
    @Override
    public ImmPurchaseDeatis insert(ImmPurchaseDeatis immPurchaseDeatis) {
        this.immPurchaseDeatisMapper.insert(immPurchaseDeatis);
        return immPurchaseDeatis;
    }

    /**
     * 修改数据
     *
     * @param immPurchaseDeatis 实例对象
     * @return 实例对象
     */
    @Override
    public ImmPurchaseDeatis update(ImmPurchaseDeatis immPurchaseDeatis) {
        this.immPurchaseDeatisMapper.update(immPurchaseDeatis);
        return this.queryById(immPurchaseDeatis.getDeatisId());
    }

    /**
     * 通过采购单ID删除
     *
     * @param purchaseId 主键
     * @return 是否成功
     */
    @Override
    public int deleteById(String purchaseId) {
        return this.immPurchaseDeatisMapper.deleteById(purchaseId);
    }

    /**
     * 通过实体作为筛选条件查询
     * @param immPurchaseDeatisVo 实例对象
     * @return
     */
    @Override
    public List<ImmPurchaseDeatis> queryAll(ImmPurchaseDeatisVo immPurchaseDeatisVo) {
        return this.immPurchaseDeatisMapper.queryAll(immPurchaseDeatisVo);
    }

    /**
     * 查询行数
     * @param immPurchaseDeatisVo
     * @return
     */
    @Override
    public int count(ImmPurchaseDeatisVo immPurchaseDeatisVo) {
        return this.immPurchaseDeatisMapper.count(immPurchaseDeatisVo);
    }

    /**
     * 批量增加
     * @param list
     * @return
     */
    @Override
    public int insertBatch(List<ImmPurchaseDeatis> list) {
        return this.immPurchaseDeatisMapper.insertBatch(list);
    }


}